package listbyorder.access101_200.test190;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/6/15 14:13
 */
public class Solution1 {

    public int reverseBits(int n) {
        int res = 0;
        int count = 0;
        while(count < 32){
            res <<= 1;   // res左移一位空出位置
            res |= (n & 1);   // 将最低位加过来
            n >>= 1;  // n右移一位，将最低位抵消掉
            count++;
        }
        return res;
    }
}
